#ifndef SHEET_H
#define SHEET_H

	#define MAX_SHEET_SIZE 256

	#define SHEET_FLAG_USED 1
#include "memory.h"

	struct SHEET_MANAGEMENT ;
	

	typedef struct { 
		unsigned char * buf ;
		int bxsize ,bysize ,vx0 ,vy0 ,col_inv ,height ,flags ; 
		struct SHEET_MANAGEMENT * shtman ;
	} SHEET;

	typedef struct  
	{
		unsigned char * vram  ;
		int xsize ,ysize ,top ;   //top代表当前的最高高度
		SHEET * ascsheets [MAX_SHEET_SIZE] ; //升序排列的图层指针
		SHEET  sheets0 [MAX_SHEET_SIZE] ;
		
	} SHEET_MANAGEMENT;

	SHEET_MANAGEMENT * shtman_init (MEMORY_MANAGEMENT * memman ,unsigned char * vram ,int xsize ,int ysize) ;
	SHEET * sheet_alloc (SHEET_MANAGEMENT * shtman) ;
	void sheet_setbuf (SHEET * sht ,char * buf ,int bxsize ,int bysize ,int col_inv);
	void sheet_updown (SHEET * sht ,int height);
	void sheet_refresh_bysht ( SHEET * sht ) ;
	void sheet_refresh_bysht2 (SHEET * sht ,int x0 ,int y0 ,int x1,int y1);
	void sheet_refresh (SHEET_MANAGEMENT * shtman ,int vx0 ,int vy0 ,int vx1 ,int vy1);
	void sheet_refresh_between (SHEET_MANAGEMENT * shtman ,int vx0 ,int vy0 ,int vx1 ,int vy1 ,int h0 ,int h1) ;
	void sheet_slide (SHEET * sht , int vx0 ,int vy0 ) ;
	void sheet_free (SHEET * sht);


#endif   

	  